module.exports = {
	// state 返回减少过的数值  false 原始组件的样式
	getConmentStyle: function(ids, state = true,self) {
		return new Promise((resolve, reject) => {
			uni.getSystemInfo({
				success: function(res) {
					var windowHeight = res.windowHeight;
					// #ifdef  MP-ALIPAY
					var dom = my
						.createSelectorQuery()
						.select(ids)
						.boundingClientRect()
						.exec(res => {
							console.log(res[0].height, 'res');

							if (state) {
								let tabHeight = windowHeight - res[0].height;
								resolve(tabHeight, res)
							} else {
								resolve(res[0].height, res)
							}
						});

					// #endif


					// #ifdef  MP-WEIXIN||H5||APP-PLUS
					var dom = uni.createSelectorQuery().select(ids);
					dom.fields({
							size: true
						},
						res2 => {
							console.log(res2,"++++++")
							if (!res2) {
								return;
							}
							if (state) {
								
								let tabHeight = windowHeight - res2.height-self.CustomBar
								// #ifdef  MP-WEIXIN
								let tabHeight = windowHeight - res2.height - 64;
								// #endif

								// #ifdef  APP-PLUS
								tabHeight = tabHeight

								// #endif

								resolve(tabHeight)
							} else {
								resolve(res2.height)
							}


						}
					).exec();
					// #endif
				}
			});
		});
	}
}
